<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
    <title>文件管理系统</title>
    <style>
        .content {
            width: 80%;
            margin: 10px auto;
        }

        .td_style {
            width: 300px;
        }
    </style>
</head>
<body>
<div class="content panel panel-primary">
    <div class="panel-heading">
        <h3 class="panel-title">文件上传下载</h3>
    </div>
    <div class="panel-body">
        <div class="form-group">
            <form method="post" enctype="multipart/form-data" th:action="@{/file/upload}">
                <input type="file" name="multipartFile">
                <input type="submit" style="margin-top:20px" value="点击上传" class="btn btn-primary btn-sm"/>
            </form>
        </div>
        <table class="table table-bordered">
            <tr>
                <td width="100px">文件原名称</td>
                <td>文件新名称</td>
                <td>储存路径</td>
                <td>文件大小(字节)</td>
                <td>文件类型</td>
                <td>上传时间</td>
                <td>操作</td>
            </tr>
            <tr th:each="file:${fileList}">
                <td class="td_style" th:text="${file.oldName}"/>
                <td th:text="${file.newName}"/>
                <td th:text="${file.urlPath}"/>
                <td th:text="${file.size}"/>
                <td th:text="${file.fileType}"/>
                <td th:text="${#dates.format(file.createdDate,'yyyy-MM-dd-HH:mm:ss')}"/>
                <td>
                    <a class="btn btn-success" role="button" th:href="@{/file/download(id=${file.id})}">下载</a>
                    <a class="btn btn-danger" role="button" th:href="@{/file/delete(id=${file.id})}">删除</a>
                </td>
            </tr>
        </table>
    </div>
</div>
</body>
</html>